<?php
/**
 * Created by IntelliJ IDEA.
 * User: admin
 * Date: 3/29 0029
 * Time: 10:00
 */

namespace app\index\model;


use think\Model;

class Merchant extends Model
{

    /**
     * 添加商户
     */
    public function addmerchant(){
        if(request()->param("merchantid")!=null){
            $res=$this->isUpdate(true)->save([
                "mername"=>request()->param("mername"),
                "industry"=>request()->param("industry"),
                "address"=>request()->param("address"),
                "contact"=>request()->param("contact"),
                "contactphone"=>request()->param("contactphone")
            ],["id"=>request()->param("merchantid")]);
        }else{
            $this->data([
                "mername"=>request()->param("mername"),
                "industry"=>request()->param("industry"),
                "address"=>request()->param("address"),
                "contact"=>request()->param("contact"),
                "contactphone"=>request()->param("contactphone")
            ]);
            $res=$this->save();
        }
        return $res;
    }

    /**
     * 获取所有商户列表
     */
    public function getall(){
        return $this->select();
    }



}